/**
 * 
 */
package org.dragonfire.dasm.directives;

import java.util.ArrayList;

import org.dragonfire.dasm.Command;
import org.dragonfire.dasm.Listing;
import org.dragonfire.dasm.DirectiveManager.Directive;

/**
 * //Need to fill in definition of an enumeration.<br />
 * <br />
 * Format:<br />
 * <code>#ENUM <i>&lt;name&gt;</i>,<i>&lt;arg1&gt;</i>[,<i>&lt;arg2&gt;</i>[,...]]</code><br />
 * <br />
 * Parameters:<br />
 * <table>
 * <tr>
 * <td><code>name</code></td>
 * <td>The name of the enumeration.</td>
 * </tr>
 * <tr>
 * <td><code>arg1</code></td>
 * <td>The name of the member</td>
 * </tr>
 * </table><br />
 * Errors:<br />
 * <table>
 * <tr>
 * <td><code>ERROR_NOT_ENOUGH_ARGS</code></td>
 * <td>Thrown if <code>name</code> is not defined</td>
 * </tr>
 * <tr>
 * <td><code>ERROR_STRING_REQUIRED</code></td>
 * <td>Thrown if <code>arg1</code> or <code>name</code> are not strings.</td>
 * </tr>
 * </table>
 * 
 * @author Darth Android
 * @version 2.0
 */
public class Enum extends Directive {

	/**
	 * {@inheritDoc}
	 */
	@Override
	public ArrayList<Listing> pass1(Command c) {
		// get name
		String name = evalString(c.getParam(0));
		// loop through remaining parameters
		for (int i = 1; i < c.getParams().length; i++) {
			getPreprocessor().define(name + "." + evalString(c.getParam(i)), i + "");
		}
		return null;
	}
}
